# lib.format

- **Type:** `'esm' | 'cjs' | 'umd' | 'mf'`
- **Default:** `undefined`
- **Required**: true

Specify the output format for the generated JavaScript output files.

For different output formats, Rslib uses the following default value of [output.library.type](https://rspack.dev/config/output#outputlibrarytype) provided by Rspack:

- `esm`：[modern-module](https://rspack.dev/config/output#type-modern-module)
- `cjs`：[commonjs-static](https://rspack.dev/config/output#type-commonjs-static)
- `umd`：[umd](https://rspack.dev/config/output#type-umd)

See [Output Format](/guide/basic/output-format) and [Module Federation](/guide/advanced/module-federation) for more details.

::: note

The `umd` format only works when [bundle](/config/lib/bundle) is set to `true`.

:::
